package com.manager.core.module.manager.controller;

import com.manager.commons.annotation.Module;
import com.manager.commons.base.DataGrid;
import com.manager.core.module.manager.service.PlatformGeneratorService;
import com.manager.core.web.json.AjaxJson;
import com.manager.gen.web.controller.AdminController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * 控制器
 *
 * @author H
 * @version 1.0
 */
@Controller
@Module(parent = "basic-manager", title = "Generator生成", show = false,code = "/platform/generator")
public class PlatformGeneratorController extends AdminController<String> {
    private final String baseUrl = "/platform/generator";
    @Autowired
    private PlatformGeneratorService _service;

    /**
     * 列表
     *
     * @return
     */
    @RequestMapping(baseUrl+"/index")
    public ModelAndView index() {
        return getModelAndView(baseUrl + "/generator-index");
    }


    /**
     * 分页
     *
     * @return
     */
    @RequestMapping(value = baseUrl+"/list", method = RequestMethod.POST)
    public @ResponseBody DataGrid list() {
        return _service.querAll();
    }

    /**
     * 保存数据
     *
     * @return
     */
    @RequestMapping(value = baseUrl+"/save", method = RequestMethod.POST)
    public @ResponseBody AjaxJson save() {
        return _service.save(getParams());
    }


    @Override
    public String getModel() {
        return "";
    }
}